/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * feeChooseDialog.java
 *
 * Created on 2011-5-11, 23:05:17
 */
package junchangmis.student;

import junchangmis.*;
import publicmethod.*;
import javax.swing.JOptionPane;

/**
 *
 * @author developers
 */
public class feeChooseDialog extends javax.swing.JDialog {

    MainFrame parent;

    /** Creates new form feeChooseDialog */
    public feeChooseDialog(java.awt.Frame parent, boolean modal, MainFrame pparent) {
        super(parent, modal);
        this.parent = pparent;
        initComponents();
        this.setTitle("学生选择");
        this.setLocationRelativeTo(null);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabelId = new javax.swing.JLabel();
        jTextFieldId = new javax.swing.JTextField();
        jButtonConfirm = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jLabelId.setFont(new java.awt.Font("华文细黑", 0, 24)); // NOI18N
        jLabelId.setText("输入学生编码");

        jTextFieldId.setFont(new java.awt.Font("华文细黑", 0, 24)); // NOI18N

        jButtonConfirm.setFont(new java.awt.Font("华文细黑", 0, 24)); // NOI18N
        jButtonConfirm.setText("确定");
        jButtonConfirm.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonConfirmActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(81, 81, 81)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jButtonConfirm)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabelId)
                        .addGap(4, 4, 4)
                        .addComponent(jTextFieldId, javax.swing.GroupLayout.PREFERRED_SIZE, 192, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(70, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(37, 37, 37)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabelId)
                    .addComponent(jTextFieldId, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(26, 26, 26)
                .addComponent(jButtonConfirm)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButtonConfirmActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonConfirmActionPerformed
        // TODO add your handling code here:
        formalStu student = new formalStu();
        boolean flag = stuChooseMethod.hasFormalStu(this.jTextFieldId.getText(), student);
        if (flag == false) {
            JOptionPane.showConfirmDialog(null, "不存在该编码的学生！", "提示", JOptionPane.CLOSED_OPTION, JOptionPane.WARNING_MESSAGE);
            return;
        } else {
            feeDialog fr = new feeDialog(this.parent, true, this.parent, student);
            dispose(); //关闭自己
            fr.setVisible(true);//
            }
    }//GEN-LAST:event_jButtonConfirmActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /*  java.awt.EventQueue.invokeLater(new Runnable() {

        public void run() {
        feeChooseDialog dialog = new feeChooseDialog(new javax.swing.JFrame(), true);
        dialog.addWindowListener(new java.awt.event.WindowAdapter() {

        public void windowClosing(java.awt.event.WindowEvent e) {
        System.exit(0);
        }
        });
        dialog.setVisible(true);
        }
        });*/
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButtonConfirm;
    private javax.swing.JLabel jLabelId;
    private javax.swing.JTextField jTextFieldId;
    // End of variables declaration//GEN-END:variables
}
